<?php 
$url=basename($_SERVER['REQUEST_URI']);
$dir=basename(getcwd());
$path_fix="";
if($dir=="discuss3") {
    $path_fix="../";
}
@session_start();

// 修改密码前不允许访问其他页面
if ( $url != 'modifypasswdpage.php' && isset($_SESSION['need_chg_passwd']) ) {
    echo "<script language='javascript'>\n";
    echo "window.location.href='/modifypasswdpage.php'\n";
    echo "</script>";
    exit(0);
}

require_once($path_fix.'include/db_info.inc.php');
require_once($path_fix.'include/online.php');
require_once($path_fix.'config/sys_config.php');

if($OJ_ONLINE){
    require_once($path_fix.'include/online.php');
	$on = new online();
}
?>
<!-- Static navbar -->
<nav class="navbar navbar-default col-md-12" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="<?php echo SysConfig::$HP_URL?>"><?php echo SysConfig::$HP_NAME?></a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <?php $ACTIVE="class='active'"?>
                <li>
                    <a href="<?php echo SysConfig::$BLOG_URL?>"><?php echo SysConfig::$BLOG_NAME?></a>
                </li>
                <li <?php if ($url=="faqs.php") echo " $ACTIVE";?>>
                    <a href="<?php echo SysConfig::$HELP_URL?>"><?php echo SysConfig::$HELP_NAME?></a>
                </li>
                <li <?php if ($url=="problemset.php") echo " $ACTIVE";?>>
                    <a href="<?php echo $path_fix?>problemset.php"><?php echo SysConfig::$MSG_PROBLEMS?></a>
                </li>
                <li <?php if ($url=="category.php") echo " $ACTIVE";?>>
                    <a href="<?php echo $path_fix?>category.php"><?php echo SysConfig::$MSG_SOURCE?></a>
                </li>
                <li <?php if ($url=="status.php") echo " $ACTIVE";?>>
                    <a href="<?php echo $path_fix?>status.php"><?php echo SysConfig::$MSG_STATUS?></a>
                </li>
                <li <?php if ($url=="ranklist.php") echo " $ACTIVE";?>>
                    <a href="<?php echo $path_fix?>ranklist.php"><?php echo SysConfig::$MSG_RANKLIST?></a>
                </li>
                <li <?php if ($url=="index.php") echo " $ACTIVE";?>>
                    <a href="<?php echo $path_fix?>index.php"><?php echo SysConfig::$MSG_HOME?></a>
                </li>
            </ul>

            <!--比赛相关--------------->
                <?php if(isset($_GET['cid'])){
                    $cid=intval($_GET['cid']);
                ?>
	            <li><a>[</a></li>
                    <li class="active" ><a href="<?php echo $path_fix?>contest.php?cid=<?php echo $cid?>">
			        <?php echo $MSG_PROBLEMS?>
	                </a></li>
                    <li  class="active" ><a href="<?php echo $path_fix?>status.php?cid=<?php echo $cid?>">
			<?php echo $MSG_STATUS?>
	      </a></li>
              <li  class="active" ><a href="<?php echo $path_fix?>contestrank.php?cid=<?php echo $cid?>">
			<?php echo $MSG_RANKLIST?>
	      </a></li>
              <li  class="active" ><a href="<?php echo $path_fix?>contestrank-oi.php?cid=<?php echo $cid?>">OI
			<?php echo $MSG_RANKLIST?>
	      </a></li>
              <li  class="active" ><a href="<?php echo $path_fix?>conteststatistics.php?cid=<?php echo $cid?>">
			<?php echo $MSG_STATISTICS?>
	      </a></li>
	      <li><a>]</a></li>
            <?php }?>
            <!--比赛相关-------暂无相关功能-------->
	        <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <span id="profile">登录</span>
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu" role="menu">
                        <script src="<?php echo $path_fix."template/bs3/profile.php?".rand();?>" ></script>
                    </ul>
                </li>
            </ul>
        </div><!--/.nav-collapse -->
    </div><!--/.container-fluid -->
</nav>